﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using ReportsClassLibrary;
using SchedulesClassLibrary;
using QC;
using System.Data; //QCMeasurements reference

namespace WCF_QC_Service
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
    [ServiceContract]
    public class DataService
    {
        [OperationContract]
        public List<Report> GetReportData(DateTime startDate, DateTime endDate, string type)       
        //public List<Report> GetReportData() 
        {
            Report rpt = new Report();
            List<Report> getReports = new List<Report>();
            getReports = rpt.GetReportData(startDate, endDate, type);
            //getReports = rpt.GetReportData();
            return getReports;

        }

        [OperationContract]
        public List<MachineSchedule> GetScheduleData()
        {
            MachineSchedule ms = new MachineSchedule();
            List<MachineSchedule> getMachSched = new List<MachineSchedule>();
            getMachSched = ms.GetMachinesRunning();
            return getMachSched;

        }

        [OperationContract]
        public List<MachineSchedule> GetTeamScheduleData(int groupID)
        {
            MachineSchedule ms = new MachineSchedule();
            List<MachineSchedule> getTeamMachSched = new List<MachineSchedule>();
            getTeamMachSched = ms.GetTeamScheduleData(groupID);
            return getTeamMachSched;

        }


 //----------------------Measurements Screen --------------------------------------------
        //gets list of materials scheduled for the current day

        Measurement msm = new Measurement();

        [OperationContract]
        public DataTable ListofMaterialsScheduled()
        {
            DataTable listofmaterials = new DataTable();
            return listofmaterials = msm.ListofMaterialsScheduled();
        }

        //display gets measurements by for each material by materialid
        [OperationContract]
        public DataTable DisplayRequiredMeasurements(int materialID)
        {
            DataTable requiredmeasurements = new DataTable();
            return requiredmeasurements = msm.DisplayRequiredMeasurements(materialID);

        }
        
        [OperationContract]
        public string GetMeasurementsTaken(decimal measurement, int orderID, int materialattribID, int materialID)
        {
            Measurement msm = new Measurement();
            string results = "";
            return results = msm.GetMeasurementsTaken(measurement, orderID, materialattribID, materialID);
        }

      
    }
}
